<!-- xml version="1.0" encoding="utf-8" -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
	<title>Latin Pronouns</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<link href="classics.css" rel="stylesheet" type="text/css">
</head>

<?php


$pronouns['ego']['Singular'] = array('Nom.' => 'ego', 'Gen.' => 'meī', 'Dat.' => array('mihi', 'mī'), 'Acc.' => 'mē', 'Abl.' => 'mē');
$pronouns['ego']['Plural'] = array('Nom.' => 'nōs', 'Gen.' => array('nostrum', 'nostrī'), 'Dat.' => 'nōbīs', 'Acc.' => 'nōs', 'Abl.' => 'nōbīs');

$pronouns['tū']['Singular'] = array('Nom.' => 'tū', 'Gen.' => 'tuī', 'Dat.' => 'tibi', 'Acc.' => 'tē', 'Abl.' => 'tē');
$pronouns['tū']['Plural'] = array('Nom.' => 'vōs', 'Gen.' => array('vestrum', 'vestrī'), 'Dat.' => 'vōbīs', 'Acc.' => 'vōs', 'Abl.' => 'vōbīs');

$pronouns['suī']['Singular'] = array('Gen.' => 'suī', 'Dat.' => 'sibi', 'Acc.' => array('sē', 'sēsē'), 'Abl.' => array('sē', 'sēsē'));
$pronouns['suī']['Plural'] = array('Gen.' => 'suī', 'Dat.' => 'sibi', 'Acc.' => array('sē', 'sēsē'), 'Abl.' => array('sē', 'sēsē'));

$pronouns['hīc']['M.']['Singular'] = array('Nom.' => 'hīc', 'Gen.' => 'hūius', 'Dat.' => 'huic', 'Acc.' => 'hunc', 'Abl.' => 'hōc');
$pronouns['hīc']['M.']['Plural'] = array('Nom.' => 'hī', 'Gen.' => 'hōrum', 'Dat.' => 'hīs', 'Acc.' => 'hōs', 'Abl.' => 'hīs');
$pronouns['hīc']['F.']['Singular'] = array('Nom.' => 'haec', 'Gen.' => 'hūius', 'Dat.' => 'huic', 'Acc.' => 'hanc', 'Abl.' => 'hāc');
$pronouns['hīc']['F.']['Plural'] = array('Nom.' => 'hae', 'Gen.' => 'hārum', 'Dat.' => 'hīs', 'Acc.' => 'hās', 'Abl.' => 'hīs');
$pronouns['hīc']['N.']['Singular'] = array('Nom.' => 'hōc', 'Gen.' => 'hūius', 'Dat.' => 'huic', 'Acc.' => 'hōc', 'Abl.' => 'hōc');
$pronouns['hīc']['N.']['Plural'] = array('Nom.' => 'haec', 'Gen.' => 'hōrum', 'Dat.' => 'hīs', 'Acc.' => 'haec', 'Abl.' => 'hīs');

$pronouns['iste']['M.']['Singular'] = array('Nom.' => 'iste', 'Gen.' => 'istīus', 'Dat.' => 'istī', 'Acc.' => 'istum', 'Abl.' => 'istō');
$pronouns['iste']['M.']['Plural'] = array('Nom.' => 'istī', 'Gen.' => 'istōrum', 'Dat.' => 'istīs', 'Acc.' => 'istōs', 'Abl.' => 'istīs');
$pronouns['iste']['F.']['Singular'] = array('Nom.' => 'ista', 'Gen.' => 'istīus', 'Dat.' => 'istī', 'Acc.' => 'istam', 'Abl.' => 'istā');
$pronouns['iste']['F.']['Plural'] = array('Nom.' => 'istae', 'Gen.' => 'istārum', 'Dat.' => 'istīs', 'Acc.' => 'istās', 'Abl.' => 'istīs');
$pronouns['iste']['N.']['Singular'] = array('Nom.' => 'istud', 'Gen.' => 'istīus', 'Dat.' => 'istī', 'Acc.' => 'istud', 'Abl.' => 'istō');
$pronouns['iste']['N.']['Plural'] = array('Nom.' => 'ista', 'Gen.' => 'istōrum', 'Dat.' => 'istīs', 'Acc.' => 'ista', 'Abl.' => 'istīs');

$pronouns['ille']['M.']['Singular'] = array('Nom.' => 'ille', 'Gen.' => 'illīus', 'Dat.' => 'illī', 'Acc.' => 'illum', 'Abl.' => 'illō');
$pronouns['ille']['M.']['Plural'] = array('Nom.' => 'illī', 'Gen.' => 'illōrum', 'Dat.' => 'illīs', 'Acc.' => 'illōs', 'Abl.' => 'illīs');
$pronouns['ille']['F.']['Singular'] = array('Nom.' => 'illa', 'Gen.' => 'illīus', 'Dat.' => 'illī', 'Acc.' => 'illam', 'Abl.' => 'illā');
$pronouns['ille']['F.']['Plural'] = array('Nom.' => 'illae', 'Gen.' => 'illārum', 'Dat.' => 'illīs', 'Acc.' => 'illās', 'Abl.' => 'illīs');
$pronouns['ille']['N.']['Singular'] = array('Nom.' => 'illud', 'Gen.' => 'illīus', 'Dat.' => 'illī', 'Acc.' => 'illud', 'Abl.' => 'illō');
$pronouns['ille']['N.']['Plural'] = array('Nom.' => 'illa', 'Gen.' => 'illōrum', 'Dat.' => 'illīs', 'Acc.' => 'illa', 'Abl.' => 'illīs');


$pronouns['is']['M.']['Singular'] = array('Nom.' => 'is', 'Gen.' => 'ēius', 'Dat.' => 'eī', 'Acc.' => 'eum', 'Abl.' => 'eō');
$pronouns['is']['M.']['Plural'] = array('Nom.' => array('eī', 'iī'), 'Gen.' => 'eōrum', 'Dat.' => array('eīs', 'iīs'), 'Acc.' => 'eōs', 'Abl.' => array('eīs', 'iīs'));
$pronouns['is']['F.']['Singular'] = array('Nom.' => 'ea', 'Gen.' => 'ēius', 'Dat.' => 'eī', 'Acc.' => 'eam', 'Abl.' => 'eā');
$pronouns['is']['F.']['Plural'] = array('Nom.' => 'eae', 'Gen.' => 'eārum', 'Dat.' => array('eīs', 'iīs'), 'Acc.' => 'eās', 'Abl.' => array('eīs', 'iīs'));
$pronouns['is']['N.']['Singular'] = array('Nom.' => 'id', 'Gen.' => 'ēius', 'Dat.' => 'eī', 'Acc.' => 'id', 'Abl.' => 'eō');
$pronouns['is']['N.']['Plural'] = array('Nom.' => 'ea', 'Gen.' => 'eōrum', 'Dat.' => array('eīs', 'iīs'), 'Acc.' => 'ea', 'Abl.' => array('eīs', 'iīs'));

$pronouns['īdem']['M.']['Singular'] = array('Nom.' => 'īdem', 'Gen.' => 'ēiusdem', 'Dat.' => 'eīdem', 'Acc.' => 'eundem', 'Abl.' => 'eōdem');
$pronouns['īdem']['M.']['Plural'] = array('Nom.' => array('eīdem', 'iīdem'), 'Gen.' => 'eōrundem', 'Dat.' => array('eīsdem', 'iīsdem'), 'Acc.' => 'eōsdem', 'Abl.' => array('eīsdem', 'iīsdem'));
$pronouns['īdem']['F.']['Singular'] = array('Nom.' => 'eadem', 'Gen.' => 'ēiusdem', 'Dat.' => 'eīdem', 'Acc.' => 'eandem', 'Abl.' => 'eādem');
$pronouns['īdem']['F.']['Plural'] = array('Nom.' => 'eaedem', 'Gen.' => 'eārundem', 'Dat.' => array('eīsdem', 'iīsdem'), 'Acc.' => 'eāsdem', 'Abl.' => array('eīsdem', 'iīsdem'));
$pronouns['īdem']['N.']['Singular'] = array('Nom.' => 'idem', 'Gen.' => 'ēiusdem', 'Dat.' => 'eīdem', 'Acc.' => 'idem', 'Abl.' => 'eōdem');
$pronouns['īdem']['N.']['Plural'] = array('Nom.' => 'eadem', 'Gen.' => 'eōrundem', 'Dat.' => array('eīsdem', 'iīsdem'), 'Acc.' => 'eadem', 'Abl.' => array('eīsdem', 'iīsdem'));

$pronouns['ipse']['M.']['Singular'] = array('Nom.' => 'ipse', 'Gen.' => 'ipsīus', 'Dat.' => 'ipsī', 'Acc.' => 'ipsum', 'Abl.' => 'ipsō');
$pronouns['ipse']['M.']['Plural'] = array('Nom.' => 'ipsī', 'Gen.' => 'ipsōrum', 'Dat.' => 'ipsīs', 'Acc.' => 'ipsōs', 'Abl.' => 'ipsīs');
$pronouns['ipse']['F.']['Singular'] = array('Nom.' => 'ipsa', 'Gen.' => 'ipsīus', 'Dat.' => 'ipsī', 'Acc.' => 'ipsam', 'Abl.' => 'ipsā');
$pronouns['ipse']['F.']['Plural'] = array('Nom.' => 'ipsae', 'Gen.' => 'ipsārum', 'Dat.' => 'ipsīs', 'Acc.' => 'ipsās', 'Abl.' => 'ipsīs');
$pronouns['ipse']['N.']['Singular'] = array('Nom.' => 'ipsum', 'Gen.' => 'ipsīus', 'Dat.' => 'ipsī', 'Acc.' => 'ipsum', 'Abl.' => 'ipsō');
$pronouns['ipse']['N.']['Plural'] = array('Nom.' => 'ipsa', 'Gen.' => 'ipsōrum', 'Dat.' => 'ipsīs', 'Acc.' => 'ipsa', 'Abl.' => 'ipsīs');

$pronouns['quī']['M.']['Singular'] = array('Nom.' => 'quī', 'Gen.' => 'cūius', 'Dat.' => 'cui', 'Acc.' => 'quem', 'Abl.' => 'quō');
$pronouns['quī']['M.']['Plural'] = array('Nom.' => 'quī', 'Gen.' => 'quōrum', 'Dat.' => 'quibus', 'Acc.' => 'quōs', 'Abl.' => 'quibus');
$pronouns['quī']['F.']['Singular'] = array('Nom.' => 'quae', 'Gen.' => 'cūius', 'Dat.' => 'cui', 'Acc.' => 'quam', 'Abl.' => 'quā');
$pronouns['quī']['F.']['Plural'] = array('Nom.' => 'quae', 'Gen.' => 'quārum', 'Dat.' => 'quibus', 'Acc.' => 'quās', 'Abl.' => 'quibus');
$pronouns['quī']['N.']['Singular'] = array('Nom.' => 'quod', 'Gen.' => 'cūius', 'Dat.' => 'cui', 'Acc.' => 'quod', 'Abl.' => 'quō');
$pronouns['quī']['N.']['Plural'] = array('Nom.' => 'quae', 'Gen.' => 'quōrum', 'Dat.' => 'quibus', 'Acc.' => 'quae', 'Abl.' => 'quibus');

$pronouns['quis']['M./F.']['Singular'] = array('Nom.' => 'quis', 'Gen.' => 'cūius', 'Dat.' => 'cui', 'Acc.' => 'quem', 'Abl.' => 'quō');
$pronouns['quis']['N.']['Singular'] = array('Nom.' => 'quid', 'Gen.' => 'cūius', 'Dat.' => 'cui', 'Acc.' => 'quid', 'Abl.' => 'quō');

$Nom = array_rand($pronouns);

$tab = "<caption>".$Nom."</caption>\n";
$n = 3;

if (isset($pronouns[$Nom]['Singular'])) {
	$tab = $tab . "<tr>";
	foreach($pronouns[$Nom] as $number => $nPro) {
		$tab = $tab . "<th align=\"center\" colspan=2>$number</th>";
	}
	$tab = $tab . "</tr>\n";
	
	foreach(array('Nom.', 'Gen.', 'Dat.', 'Acc.', 'Abl.') as $case) {
		if (isset($pronouns[$Nom]['Singular'][$case]) || isset($pronouns[$Nom]['Plural'][$case])) {
			$tab = $tab . "<tr><th>$case</th>";
			foreach(array('Singular', 'Plural') as $number) {
				if (isset($pronouns[$Nom][$number][$case])) {
					
					$tab = $tab . "<td align=\"center\">";
					if (is_array($pronouns[$Nom][$number][$case])) {
						foreach($pronouns[$Nom][$number][$case] as $pn) {
							$txts[] = $pn;
							$tab = $tab . "<input name=\"text".(count($txts) - 1)."\" type=\"text\"> ";
						}
					} else {
						$txts[] = $pronouns[$Nom][$number][$case];
						$tab = $tab . "<input name=\"text".(count($txts) - 1)."\" type=\"text\">";
					}
					$tab = $tab . "</td>";
				}
			}
			$tab = $tab . "</tr>\n";
		}
	}
} else {
	
	$n = count($pronouns[$Nom]) + 1;
	$tmp = '';
	foreach($pronouns[$Nom]['N.'] as $number => $nPro) {
		$tab = $tab . "<tr class=\"separate-above\">";
		$tab = $tab . "<th align=\"center\" colspan=\"$n\">$number</th></tr>\n";
		$tab = $tab . "<tr bgcolor=\"CadetBlue\"><td></td>";
		foreach($pronouns[$Nom] as $gender => $gPro) {
			$tab = $tab."<th align=\"center\">$gender</th>";
		}
		$tab = $tab . "</tr>\n";
	
		
		foreach(array('Nom.', 'Gen.', 'Dat.', 'Acc.', 'Abl.') as $case) {
			$tab = $tab . "<tr><th>$case</th>";
			foreach($pronouns[$Nom] as $gender => $gPro) {
				$tab = $tab . "<td align=\"center\">";
				if (is_array($gPro[$number][$case])) {
					foreach($gPro[$number][$case] as $pn) {
						$txts[] = $pn;
						$tab = $tab . "<input name=\"text".(count($txts) - 1)."\" type=\"text\" size=\"10\"> ";
					}
				} else {
					$txts[] = $gPro[$number][$case];
					$tab = $tab . "<input name=\"text".(count($txts) - 1)."\" type=\"text\" size=\"10\">";
				}
				$tab = $tab . "</td>";
				
			}
			
			$tab = $tab . "</tr>\n";
		
		}
	}
}

$b = floor($n/2);
$a = $n - $b;
?>

<script type="text/javascript">
function check() 
{

<?php
	for($i = 0, $nall = count($txts); $i < $nall; $i++) {
		print "if (document.n01.text".$i.".value=='".$txts[$i]."')\n{\n";
		print "\tdocument.n01.text".$i.".disabled=true;\n}\n";
	}
?>

}

function newWord() 
{
<?php
	for($i = 0, $nall = count($txts); $i < $nall; $i++) {
		print "document.n01.text".$i.".disabled=false;\n";
 		print "document.n01.text".$i.".value='';\n";
	}
?>
	location.reload();
}
</script>

<body>
<div id="container">
<div id="center">
<form name="n01" action="">
<table align="center">
<?php
	print $tab;
?>
<tr>
	<td align="center" colspan=<?php echo $a; ?>><input name="Check" onclick="check()" value="Check" type="button"></td>
	<td align="center" colspan=<?php echo $b; ?>><input name="New Word" onclick="newWord()" value="New Word" type="button"></td>
</tr>
</table>
</form>
</div>
</div>
</body>
</html>
